import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
func_num = 18
method_num = 5
for i in range(1, func_num + 1):
    if i == 14:
        continue
    else:
        plt.figure(1)
        for method in range(1, method_num + 1):
            if method == 1:
                method_name = 'pso_basic'
            elif method == 2:
                method_name = 'gbest_basic'
            elif method == 3:
                method_name = 'mbest_basic'
            elif method == 4:
                method_name = 'gbest_new'
            elif method == 5:
                method_name = 'mbest_new'
            filename = 'F' + str(i) + '_' + method_name + '.npy'
            result = np.load(filename)
            plt.plot(result, label=method_name)
    plt.legend(loc='upper right')
    picture_name = 'F' + str(i)
    plt.savefig(picture_name)
    plt.close(1)
    # plt.show()
